package day10;

public class Demo06 {
    public static void main(String[] args) {
        /*
         * 二维数组: 元素是一维数组的数组
         */
        String[] names1 = {"Tom", "Jerry"};
        String[] names2 = {"Mac", "Nemo"};
        String[] names3 = {"Hook", "Lee"};
        //            Srtring[],Srtring[],Srtring[]
        String[][] arr = {names1, names2, names3};
        System.out.println(arr[0][1]);
        //用长度初始化时候, 必须初始化第一维
        String[] ary = new String[4];
        String[][] arr2 = new String[3][2];
        //    {{null, null}, {null, null}, {null, null}}
        String[][] arr3 = {};
        //2维数组的第二维长度可以不一致!
        String[][] arr4 = {{"Tom", "Jerry"},{"Andy"}};
        System.out.println(arr4.length);//2
        System.out.println(arr4[0].length);//2
        System.out.println(arr4[1].length);//1

    }
}
